#!/usr/bin/env bash
sudo apt install curl gnupg2 ca-certificates lsb-release
# 下载key
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor  | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
# 验证key
gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg
echo "deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt-key fingerprint ABF5BD827BD9BF62
sudo apt update
sudo apt install nginx
sudo cp /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/